package br.com.base.model.impl;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.MappedSuperclass;

import br.com.base.model.IEntidade;
import br.com.base.model.UsuarioBase;

/**
 * @author Milton Domingues
 */
@MappedSuperclass
public abstract class Entidade<ID extends Serializable> implements IEntidade<ID>{

	private static final long serialVersionUID = -3007501547856087416L;

	private ID id;

	public Entidade() {

	}

	@SuppressWarnings("rawtypes")
	@Override
	public boolean equals(Object obj) {
		boolean equals = false;
		try{
			if(obj != null){
				if ((getId().equals(((Entidade) obj).getId()))) {
					equals = true;
				} else if (obj == this) {
					equals = true;
				}
			}
		} catch (ClassCastException e) {
			equals = false;
		}
		return equals;
	}

	@Override
	public ID getId(){
		return this.id;
	}

	public abstract void setDataAlteracao(Date dataAlteracao);

	public abstract void setDataInclusao(Date dataInclusao);

	public void setId(ID id) {
		this.id = id;
	}

	public void setUsuarioAlteracao(UsuarioBase usuarioAlteracao){

	}

	public void setUsuarioInclusao(UsuarioBase usuarioInclusao){

	}

}
